package log;

import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class AsyncManger {
    private AsyncManger(){}
    private static class SingletonHolder{
        private static final AsyncManger INSTANCE = new AsyncManger();
    }

    public static AsyncManger getInstance(){
        return SingletonHolder.INSTANCE;
    }

    private final ExecutorService executorService = Executors.newFixedThreadPool(10);

    public void execute(Runnable task){
       executorService.execute(task);

    }

    /*public static void main(String[] args) {
        String user= "lisi";
        String msg = "运行";
        Log runLog = new RunLog();
        String msg2 = "登录";
        Log loginLog = new LoginLog();

        AsyncManger.getInstance().execute(new LogTask(runLog,msg,user));
        AsyncManger.getInstance().execute(new LogTask(loginLog,msg2,user));
    }*/

}
